##rem $Id: Oberon_V38.sd,v 1.2 1999/11/28 03:36:42 carlos Exp $
##stringtype Oberon
##shortstrings
(****************************************************************
   This file was created automatically by `%fv'
   from "%f0".

   Do NOT edit by hand!
****************************************************************)

MODULE %b;


IMPORT
  lo := Locale, e := Exec, u := Utility, y := SYSTEM;

CONST
  builtinlanguage = %l;
  version = %v;

  %i* = %d;\n%iSTR = %s;\n\n


TYPE
  AppString = STRUCT
     id  : LONGINT;
     str : e.STRPTR;
  END;
  AppStringArray = ARRAY %n OF AppString;

CONST
  AppStrings = AppStringArray (
    %i, y.ADR(%iSTR)%(,)
  );

VAR
  catalog : lo.CatalogPtr;

  PROCEDURE CloseCatalog*();
    BEGIN
      IF catalog # NIL THEN lo.CloseCatalog (catalog); catalog:=NIL END;
   END CloseCatalog;

  PROCEDURE OpenCatalog*(loc:lo.LocalePtr; language:ARRAY OF CHAR);
    VAR Tag : u.Tags4;
    BEGIN
      CloseCatalog();
      IF (catalog = NIL) & (lo.base # NIL) THEN
        Tag:= u.Tags4(lo.BuiltInLanguage, y.ADR(builtinlanguage),
                      u.skip, u.done, lo.Version, version, u.done, u.done);
        IF language # "" THEN
          Tag[1].tag:= lo.Language; Tag[1].data:= y.ADR(language);
        END;
        catalog := lo.OpenCatalogA (loc, "%b.catalog", Tag);
      END;
    END OpenCatalog;

  PROCEDURE GetString* (num: LONGINT): e.STRPTR;
    VAR
      i: LONGINT;
      default: e.STRPTR;
    BEGIN
      i := 0; WHILE (i < %n) AND (AppStrings[i].id # num) DO INC (i) END;

      IF i # %n THEN
      default := AppStrings[i].str;
      ELSE
        default := NIL;
      END;

      IF catalog # NIL THEN
        RETURN lo.GetCatalogStr (catalog, num, default^);
      ELSE
        RETURN default;
      END;
    END GetString;

CLOSE
  CloseCatalog();
END Chaos.
